package com.tte.common.designpattern.command;

import java.util.ArrayList;
import java.util.List;

/**
 * @PackageName: com.tte.common.designpattern.command
 * @ClaseName: Broker
 * @Description: Broker
 * @Author: DongWH
 * @Date: 2022/3/24 10:31
 * @params *@params $
 */
public class Broker {
    private List<Order> orderList = new ArrayList<Order>();

    public void takeOrder(Order order){
        orderList.add(order);
    }

    public void placeOrders(){
        for (Order order : orderList) {
            order.execute();
        }
        orderList.clear();
    }
}
